package com.study.dao;

import com.study.pojo.Account;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import java.util.List;

public class UserMapperImpl extends SqlSessionDaoSupport implements UserMapper{
    public List<Account> getAccounts() {
        Account account = new Account(6,"Hello6","123");
        UserMapper mapper = getSqlSession().getMapper(UserMapper.class);
        mapper.addAccount(account);
        mapper.deleteAccount(6);
        return mapper.getAccounts();
    }

    public int addAccount(Account account) {
        return getSqlSession().getMapper(UserMapper.class).addAccount(account);
    }

    public int deleteAccount(int id) {
        return getSqlSession().getMapper(UserMapper.class).deleteAccount(id);
    }
}
